' ##############################################################################
' Components
' ##############################################################################
with frmState1
	.width = 218: .Height = 135
	.delbordericons 1, 2
	.borderstyle = 1
	.center
	SetWindowLong .HANDLE, -8, 0
	SetWindowLong application.HANDLE, -8, .HANDLE
end with

	with lblStateName
		.parent = frmState1
		.top = 13: .left = 10
		.caption = "The name:"
	end with

	with ediStateName
		.parent = frmState1
		.left = 80: .top = 10
		.width = 120
		.onkeyup = ediStateName_onKeyUp
	end with

	with lblStateCode
		.parent = frmState1
		.top = 38: .left = 10
		.caption = "The code:                           (3 chars)"
	end with

	with ediStateCode
		.parent = frmState1
		.left = 80: .top = 35
		.width = 50
		.CharCase = 1 'ecUpperCase'
		.MaxLength = 3
		.onKeyUp = ediStateCode_onKeyUp
	end with

	with btnStatOK
		.parent = frmState1
		.left = 10: .top = 65: .width = 80: .height = 30
		.kind = 1
	end with

	with btnStatCancel
		.parent = frmState1
		.left = 120: .top = 65: .width = 80: .height = 30
		.kind = 2
	end with

' ##############################################################################
' Subs
' ##############################################################################
	sub ediStateName_onKeyUp
		If len(ediStateName.EditText) < 2 or len(ediStateCode.EditText) < 3 then
			btnStatOK.enabled = 0
			if key = 13 then SetFocus (ediStateCode.Handle)
		else: btnStatOK.enabled = 1
		end If
	end sub

' ------------------------------------------------------------------------------
	sub ediStateCode_onKeyUp
		If len(ediStateName.EditText) < 2 or len(ediStateCode.EditText) < 3 then
			btnStatOK.enabled = 0
		else: btnStatOK.enabled = 1
		end If
	end sub
